home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / bterro.zip / BTERROR.DOC next >
Text File  |  1989-12-14  |  4KB  |  77 lines

  1. I wrote this unit as an initial error handler for Turbo Professional's BTree 
  2. Filer. It contains all of the error messages from the documentation, including 
  3. those from the ReadMe file. The procedure will pop up an error window at a
  4. specified position, and display an error message corresponding to those in 
  5. Btree Filer manual. The window remains on screen until a key is pressed. 
  6. The screen is then restored. This unit performs no error handling whatsoever. 
  7. That is your responsibility.
  8.  
  9. The interface section of the unit contains one procedure, DisplayErrorMsg., 
  10. as presented below. 
  11.  
  12.         PROCEDURE DisplayErrorMsg(ErrorNumber: Integer;
  13.                                   Col,row:     ShortInt;
  14.                                   WinAttr, 
  15.                                   FrameAttr,
  16.                                   HeaderAttr:  Byte);
  17.  
  18. The required parameters are as follows:  
  19.  
  20.         ErrorNumber should be passed IsamError. This is the number 
  21.         Btree Filer returns when an error occurs.
  22.  
  23.         Col,Row are the upper left hand corner where you want the
  24.         message window to appear.
  25.  
  26.         WinAttr,FrameAttr,HeaderAttr are the attributes for the Window,
  27.         Frame and header.
  28.  
  29. The values passed for the attributes correspond to those for the text
  30. attribute byte in Turbo pascal. The background color is contained in bits 4-6,
  31. the foreground in bits 0-3. To set the colors, look at the TextColor and
  32. TextBackground procedures in the Turbo Pascal manual. Multiply the background 
  33. color you want by 16, and add the foreground color. For a blue background with 
  34. white letters, this would be:
  35.  
  36.                        Background color Blue =  1 x 16  = 16
  37.                        Foreground Color white           = 15
  38.                                                          ----
  39.                                                           31
  40. You would set the appropriate attribute to 31.
  41. A red background with white letters would be 79 (4 x 16 + 15) and so on.
  42.  
  43. The size of the window is between 40 and 50 characters wide. The number of rows 
  44. depends on the length of the error message. The WordWrap routine from Turbo 
  45. Professional is used to break the message into lines. The width of the message 
  46. box is determined by the length of the longest line. The height is based on the 
  47. number of lines in the message.
  48.  
  49. The messages themselves are stored in .obj format, and are extracted by a 
  50. routine adapted from the Turbo Editor Toolbox. (Not required to compile.) This 
  51. unit does requires Turbo Professional 5.0 toolbox to compile. It uses TpWindow, 
  52. TpString and TpCrt.
  53.  
  54. The .PAS file, TestErr, calls this unit and displays one of the messages.
  55. Feel free to use this to test the unit, or modify it for your program.
  56.  
  57. This is the first version of the unit, and is intended more for development 
  58. rather than full use in a system. Many of the messages would not be displayed
  59. in a normal user environment, but I have found them useful in development.
  60.  
  61. The error message routine using the editor toolbox techniques Ihave found to
  62. be extremely useful, especially when a program contains a lot of text. By
  63. storing the text in .obj format, you avoid typed constants and a lot of wasted
  64. space. I use it frequently.
  65.  
  66. If you would like to receive the source code for this unit, please send $25.00
  67. to:  Robert Galivan & Associates
  68.      7700 N. Kendall Dr.  Suite 200
  69.      Box 16-1127
  70.      Miami, FL 33116.
  71.      (305) 270-1540
  72.  
  73. I will send a copy of the source on disk, along with full documentation.
  74.  
  75. I would appreciate your comments as well, either to the above address, or
  76. on compuserve, 71250,71.  Enjoy!
  77.